package net.com.hydroPK;

import net.com.hydroPK.model.Player;

/**
 * @author Fireend
 */

public class Startup {



    Player player;

    /**
     * Class constructor
     *
     * @player The player for the actions to be cast at
     */
    public Startup(Player player) {
        this.player = player;
    }

    /**
     * Load player features at Login.                 \
     */
    public void startupFeatures() {
        player.setCoords(player.absX, player.absY, player.tempHeight2); // Sets height to loaded height
        player.appendData("connection accounts/" + Server.socketListener.getAddress(player.socket.socket) + ".txt", player.username);
        player.friendsLoggedIn();
        player.actionSender.sendMessage(player, "<img=1>Welcome to Rune Resort!<img=1>");
        player.actionSender.sendMessage(player, "Register at our website: http://www.runeresort.forumotion.com");
        Engine.clanChat.join(player, "HelpCenter");

        personalMessages();
        player.actionSender.setItems(player, 149, 0, 93, player.items, player.itemsN);
        player.actionSender.setItems(player, 387, 28, 93, player.equipment, player.equipmentN);
        if (player.wildernessZone(player.absX, player.absY)) {
            player.actionSender.setPlayerOption(player, "Attack", 1, true);
            player.removedWildy = false;
        } else {
            player.actionSender.setPlayerOption(player, "Null", 1, true);
            player.removedWildy = true;
        }
        player.actionSender.setPlayerOption(player, "Trade", 2, false);
        player.actionSender.setPlayerOption(player, "Follow", 3, false);
        player.actionSender.setConfig(player, 173, 0);
        player.actionSender.setConfig(player, 313, -1);
        player.actionSender.setConfig(player, 465, -1);
        player.actionSender.setConfig(player, 802, -1);
        player.actionSender.setConfig(player, 1085, 249852);
        player.actionSender.setConfig2(player, 300, player.specAmount);
        //player.actionSender.player.heightLevel;

        if (player.rights == 2) {
            player.getQuestClass().setQuestColors();
        }
        player.actionSender.addLists(player);
        player.actionSender.setConfig(player, 172, 0);
        player.playerWeapon.setWeapon();
        player.calculateEquipmentBonus();
        player.updatePlayer(true);
        setPlayerStatus(true);

        player.loadStaticObjects();

        if (player.skillLvl[3] <= 0) {
            player.appendDeath();
        }
        if (player.newPlayer) {
            if (!player.newPlayer()) {
                player.newPlayer = false;
                player.saveCharacter();
                return;
            }
	player.setCoords(2914, 5468, 0); // First time they log in (On account creation)
	player.message("<img=1><col=ff4500>Thank you for joining Rune Resort!<img=1>");
	player.message("<col=ff4500>Any Questions or comments post them on our website: http://www.runeresort.forumotion.com.");
	player.message("<col=ff4500>If you like the server, type ::donate and read it! :)");
	player.appendExperience(5000, 0);
                    player.appendExperience(5000, 1);
                    player.appendExperience(5000, 2);
                    player.appendExperience(5000, 3);
                    player.appendExperience(5000, 4);
                    player.appendExperience(5000, 5);
                    player.appendExperience(5000, 6);
                    player.appendExperience(5000, 23);
                player.message("Because Fireend is so nice, he has given you a nice stat boost.");

            player.actionSender.setItems(player, 387, 28, 93, player.equipment, player.equipmentN);
            player.newPlayer = false;
            player.saveCharacter();
        }
    }

    /**
     * If player is online or not.
     *
     * @param online if player is online.
     */
    void setPlayerStatus(boolean online) {
        player.online = online;
    }

    public void personalMessages() {
        boolean hasmsgs = false;
        int amt = 0;
        if (hasmsgs) {
            player.message("You have " + amt + " unread messages. Please check your inbox.");
        }
    }

}
